<%@ Control Language="C#" AutoEventWireup="true"
	Inherits="System.Web.Mvc.ViewUserControl<GoldenBicycleCompany.ApplicationServices.ViewModels.BicycleFormViewModel>" %>
<%@ Import Namespace="GoldenBicycleCompany.Core" %>
<%@ Import Namespace="GoldenBicycleCompany.Web.Controllers" %>
 

<% if (ViewContext.TempData[ControllerEnums.GlobalViewDataProperty.PageMessage.ToString()] != null) { %>
    <p id="pageMessage"><%= ViewContext.TempData[ControllerEnums.GlobalViewDataProperty.PageMessage.ToString()]%></p>
<% } %>

<%= Html.ValidationSummary() %>

<% using (Html.BeginForm()) { %>
    <%= Html.AntiForgeryToken() %>
    <%= Html.Hidden("Bicycle.Id", (ViewData.Model.Bicycle != null) ? ViewData.Model.Bicycle.Id : 0)%>

    <ul>
		<li>
			<label for="Bicycle_BicycleManufacturer">BicycleManufacturer:</label>
			<div>
				<%= Html.TextBox("Bicycle.BicycleManufacturer", 
					(ViewData.Model.Bicycle != null) ? ViewData.Model.Bicycle.BicycleManufacturer.ToString() : "")%>
			</div>
			<%= Html.ValidationMessage("Bicycle.BicycleManufacturer")%>
		</li>
		<li>
			<label for="Bicycle_BicycleType">BicycleType:</label>
			<div>
				<%= Html.TextBox("Bicycle.BicycleType", 
					(ViewData.Model.Bicycle != null) ? ViewData.Model.Bicycle.BicycleType.ToString() : "")%>
			</div>
			<%= Html.ValidationMessage("Bicycle.BicycleType")%>
		</li>
		<li>
			<label for="Bicycle_Color">Color:</label>
			<div>
				<%= Html.TextBox("Bicycle.Color", 
					(ViewData.Model.Bicycle != null) ? ViewData.Model.Bicycle.Color.ToString() : "")%>
			</div>
			<%= Html.ValidationMessage("Bicycle.Color")%>
		</li>
		<li>
			<label for="Bicycle_MaintenanceRecords">MaintenanceRecords:</label>
			<div>
				<%= Html.TextBox("Bicycle.MaintenanceRecords", 
					(ViewData.Model.Bicycle != null) ? ViewData.Model.Bicycle.MaintenanceRecords.ToString() : "")%>
			</div>
			<%= Html.ValidationMessage("Bicycle.MaintenanceRecords")%>
		</li>
		<li>
			<label for="Bicycle_BarcodeIdNumber">BarcodeIdNumber:</label>
			<div>
				<%= Html.TextBox("Bicycle.BarcodeIdNumber", 
					(ViewData.Model.Bicycle != null) ? ViewData.Model.Bicycle.BarcodeIdNumber.ToString() : "")%>
			</div>
			<%= Html.ValidationMessage("Bicycle.BarcodeIdNumber")%>
		</li>
		<li>
			<label for="Bicycle_Model">Model:</label>
			<div>
				<%= Html.TextBox("Bicycle.Model", 
					(ViewData.Model.Bicycle != null) ? ViewData.Model.Bicycle.Model.ToString() : "")%>
			</div>
			<%= Html.ValidationMessage("Bicycle.Model")%>
		</li>
		<li>
			<label for="Bicycle_YearPurchased">YearPurchased:</label>
			<div>
				<%= Html.TextBox("Bicycle.YearPurchased", 
					(ViewData.Model.Bicycle != null) ? ViewData.Model.Bicycle.YearPurchased.ToString() : "")%>
			</div>
			<%= Html.ValidationMessage("Bicycle.YearPurchased")%>
		</li>
		<li>
			<label for="Bicycle_IsRented">IsRented:</label>
			<div>
				<%= Html.TextBox("Bicycle.IsRented", 
					(ViewData.Model.Bicycle != null) ? ViewData.Model.Bicycle.IsRented.ToString() : "")%>
			</div>
			<%= Html.ValidationMessage("Bicycle.IsRented")%>
		</li>
		<li>
			<label for="Bicycle_IsUnderMaintenance">IsUnderMaintenance:</label>
			<div>
				<%= Html.TextBox("Bicycle.IsUnderMaintenance", 
					(ViewData.Model.Bicycle != null) ? ViewData.Model.Bicycle.IsUnderMaintenance.ToString() : "")%>
			</div>
			<%= Html.ValidationMessage("Bicycle.IsUnderMaintenance")%>
		</li>
	    <li>
            <%= Html.SubmitButton("btnSave", "Save Bicycle") %>
	        <%= Html.Button("btnCancel", "Cancel", HtmlButtonType.Button, 
				    "window.location.href = '" + Html.BuildUrlFromExpressionForAreas<BicyclesController>(c => c.Index()) + "';") %>
        </li>
    </ul>
<% } %>
